//
//  ViewController.m
//  Homework_28
//
//  Created by 徐昊 on 16/8/22.
//  Copyright © 2016年 徐昊. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *logoDistance;
@property (weak, nonatomic) IBOutlet UIImageView *lago;
@property (weak, nonatomic) IBOutlet UIView *backView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *blueWidth;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *logWidth;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *redWidth;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    _lago.transform = CGAffineTransformMakeTranslation(0, -300);
    _logWidth.constant = 60;
    _redWidth.constant = 0;
    _blueWidth.constant = 0;
    }
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [UIView animateWithDuration:1 animations:^{
        // 恢复原样
        _lago.transform = CGAffineTransformIdentity;
        _logWidth.constant = 300;
        _redWidth.constant = _backView.frame.size.width - _backView.frame.size.height / 2;
        
        [self.view layoutIfNeeded];
    }];
    [UIView animateWithDuration:0.5 delay:0.5 options:UIViewAnimationOptionLayoutSubviews animations:^{
        
        _blueWidth.constant = _backView.frame.size.height / 2;
        [self.view layoutIfNeeded];
    } completion:^(BOOL finished) {
        
        
    }];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
